#ifndef _DAO_H
#define _DAO_H

#define DB_FILE_PATH "sqlite_db/server.db"

typedef struct{
	char username[20];
	union{
		char passwd[20];
		char friendname[20];
	};
	int state;
}db_user_t;

int tbl_dao_init();

//tbl_user表
int tbl_user_select(char* username, db_user_t* data);
int tbl_user_insert(char* username, char* passwd);
//tbl_chat_friend表
/*
int tbl_chat_friend_insert(spkg_chat_t* data);
int tbl_chat_friend_delete(int serial);
int tbl_chat_friend_select(char* destname, spkg_chat_t* dataArr, int* arrLen);
*/
//tbl_friend表操作
int tbl_friend_getState(char* username, char* friendname, int* state);
int tbl_friend_insert(char* username, char* friendname, int state);
//int tbl_friend_delete(char* username, char* friendname, int state);
int tbl_friend_updateState(char* username, char* friendname, int state);
int tbl_friend_getList(char* username, int state, db_user_t* frdArr, int* addLen);
int tbl_friend_getNum(char* username,int state);

//tbl_group表操作
int tbl_group_mygroup(char* username, char* result);
int tbl_group_groupmembers(char* groupname, char* res);
int tbl_group_insert(char* groupname, char* username, char* errmsg);


#endif
